import React from 'react';
import './weblist.css'
import { render } from 'react-dom';
const data = [
    'Racing car sprays burning fuel into crowd.',
    'Japanese princess to wed commoner.',
    'Australian walks 100km after outback crash.',
    'Man charged over missing wedding girl.',
    'Los Angeles battles huge wildfires.',
];
interface WebProps extends React.Props<any> {
    item: [];
}
/**
 * 搜索组件
 */
class Weblist extends React.Component<WebProps, any> {

    constructor(props: any) {
        super(props)
    }


    state = {
        value: 1
    }

    onChange = (e: any) => {
        console.log('radio checked', e.target.value);
        console.log(this.props.item);
        this.setState({
            value: e.target.value,
        });
    }

    render() {
        return (
            <div className="list">
                {
                    this.props.item.map(function (item: any, index) {
                        return <div className="list-item" key={index}>
                            <div className="list-title">{item.web_title}</div>
                            <div className="list-web">
                                {
                                    item.web_list.map(function (list: any, index: string) {
                                        return <div className="web" key={index}>
                                            <div className="list-web-img" >
                                                <img className="web-icon" src={list.web_url+'/favicon.ico'} alt={list.web_name} />
                                            </div>
                                            <a className="a_web" href={list.web_url} target="_blank"><div className="list-web-name">{list.web_name}</div></a>
                                        </div>
                                    })
                                }
                            </div>
                        </div>
                    })
                }

            </div>
        );
    }
}

export default Weblist;